<!-- 项目选项卡 -->
<template>
  <div class="project-card">

    <el-card style="background-color: #fff" shadow="hover">
      <span style="align-items: end;" class="flex">
        <div class="div-g" :style="fn_BGcolor(props.number)">
          <span :style="fn_color(props.number)">{{ props.number + 1 }}</span>
        </div>
        <span class="ml-4 text-lg" style="color: #bebebe;  vertical-align: top; margin-left: 0.5rem">
          项目代号:<span>{{ proj_no }}</span>
        </span>
      </span>
      <el-tooltip class="box-item" effect="dark" :content="proj_name" placement="top">
        <div style="overflow: hidden; 
             white-space: nowrap;
            text-overflow: ellipsis; " class="h-10 mt-2 text-secondary m-2-input">
          {{ proj_name }}
        </div>
      </el-tooltip>
      <div class="justify-between text-secondary">
        <div style="display: flex; align-items: center; margin-top: 10px" class="m-2-span">
          专业负责人&专业组长：
          <el-tag size="small" v-if="professional_leader" type="success">{{ professional_leader || '未指定' }}</el-tag>
          <el-tag size="small" v-if="!professional_leader" type="danger">{{ '未指定' }}</el-tag>
          &nbsp;
          <el-tag v-if="team_leader" size="small" type="success">{{ team_leader || '未指定' }}</el-tag>
          <el-tag v-if="!team_leader" size="small" type="danger">{{ '未指定' }}</el-tag>
        </div>

        <div style="display: flex; align-items: center; margin-top: 10px" class="m-2-span">
          项目周期:
          {{ start_time }} - {{ end_time }}
        </div>
      </div>

    </el-card>


  </div>
</template>

<script setup>
  import { useRouter } from 'vue-router'


  const props = defineProps(['project', 'number'])
  let { proj_oid, proj_no, proj_name, start_time, end_time, professional_leader, team_leader } = props.project

  /* 定义变量内容 */
  const router = useRouter()



  let color = ["#1890FF", "#FF4D4F", "#52C41A", "#FAAD14"];

  let background = [
    ["#C2E4FF", "#E6F4FF"],
    ["#FFD6D1", "#FFF1F0"],
    ["#DBFFBE", "#F6FFED"],
    ["#FFF8D4", "#FFFBE6"],
  ];

  let fn_color = (index) => {
    return `color:${color[index % 4]};`;
  };

  let fn_BGcolor = (index) => {

    return `background:linear-gradient(180deg, ${background[index % 4][0]} 0%, ${background[index % 4][1]} 100%);`;
  };

</script>

<style scoped lang="scss">
  :deep(.el-card__header) {
    background-image: linear-gradient(rgb(194, 228, 255) 0%, rgb(230, 244, 255) 100%);
  }

  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    span {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      width: 400px;
    }
  }

  .text {
    font-size: 14px;
  }

  .item {
    margin-bottom: 18px;
  }

  .project-card {
    margin-bottom: 16px;
  }

  .project-card:hover {
    cursor: pointer;
  }

  .project-name {
    height: 100px;
    display: flex;
  }

  .project-name span:first-child {
    /* background-color: aqua; */
    width: 80px;
    font-weight: bold;
    font-size: 1.2em;
    margin-right: 10px;
  }



  .div-g {
    width: 64px;
    height: 64px;

    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    display: inline-block;
    text-align: center;

    span {
      font-size: 33px;
      font-family: Microsoft YaHei-Bold, Microsoft YaHei;
      font-weight: bold;

      line-height: 64px;
    }
  }

  .div-h {
    width: 64px;
    height: 64px;
    background: linear-gradient(360deg, #fff1f0 0%, #ffd6d1 100%);
    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    display: inline-block;
    text-align: center;

    span {
      font-size: 52px;
      font-family: Microsoft YaHei-Bold, Microsoft YaHei;
      font-weight: bold;
      color: #ff4d4f;
      line-height: 64px;
    }
  }

  .div-gH {
    width: 64px;
    height: 64px;
    background: linear-gradient(360deg, #f6ffed 0%, #dbffbe 100%);
    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    text-align: center;

    span {
      font-size: 52px;
      font-family: Microsoft YaHei-Bold, Microsoft YaHei;
      font-weight: bold;
      color: #52c41a;
      line-height: 64px;
    }
  }

  .div-hJ {
    width: 64px;
    height: 64px;
    background: linear-gradient(360deg, #fffbe6 0%, #fff8d4 100%);
    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    text-align: center;

    span {
      font-size: 52px;
      font-family: Microsoft YaHei-Bold, Microsoft YaHei;
      font-weight: bold;
      color: #faad14;
      line-height: 64px;
    }
  }

  @media (min-width: 768px) {
    .\!md\:mr-4 {
      margin-right: 1rem !important;
    }
  }

  .\!mt-4 {
    margin-top: 0rem !important;
  }

  .m-2-ling {
    margin-bottom: 1.1rem;
  }

  .font-xm {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 1rem;
  }

  .ml-4 {
    width: 80%;
  }

  .m-2-input {
    font-size: 16px;
    font-family: Microsoft YaHei-Bold, Microsoft YaHei;
    font-weight: bold;
    color: #000000;
    margin-top: 14px;
    line-height: 20px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .m-2-span {
    font-size: 11.5px;
    font-family: Microsoft YaHei-Regular, Microsoft YaHei;
    font-weight: 400;
    color: #222020;
  }

  .htop {
    margin-bottom: 10px;
  }

  @media screen and (max-width: 1200px) {
    .htop {
      margin-top: 10px;
    }
  }

  @media screen and (max-width: 992px) {
    .htop {
      margin-top: 8px;
    }
  }

  .p_title {
    padding-left: 17px;
    position: relative;
    font-weight: bold;
    font-size: 20px;
    line-height: 24px;

    &::after {
      position: absolute;
      content: " ";
      left: 0;
      height: 100%;
      width: 8px;
      background: #22abf9;
    }
  }

  .text-line-clamp {
    display: -webkit-inline-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 2;
  }

  .cireitmep {
    font-size: 12px;
    position: absolute;
    background: #ff4d4f;
    color: white;
    border-radius: 50%;
    width: 8px;
    height: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }


</style>
